<?php 

class Office_m extends CI_Model{
	
	function __construct(){
	
		parent::__construct();
		$this->load->model('user');
		
	}
	function get_office_by_client($client_id){
		
		$this->db->where('client_id',$client_id);
		$office = $this->db->get('office');
		return ($office->num_rows() > 0) ? $office->result():false;
		
	}// end get office by client..
	function add_office_m(){
		
		$user = $this->user->get_user_info();
		
		$office = array(
			'client_id' => $user->id,
			'office_name' => $this->input->post('office_name'),
			'office_location' => $this->input->post('company_location'),
			'office_website' => $this->input->post('office_website'),
			'office_main_contact' => $this->input->post('office_main_contact'),
		);
		//adding office..
		$office_res = $this->db->insert('office',$office); // inserting office info..
		
		return ($office_res) ? true:var_dump(mysql_error());
		
	}
	
	
}// office class model..